package com.colabo.j2ee.web.core.context;

import java.io.Serializable;
import java.util.Properties;

public class CoreInitInfo implements Serializable{
	// instance of this
	private static CoreInitInfo CI_INFO = null;
	
	private Properties systemConfigs = null;
	private String msgFileDirectory;
	private String defaultErrorPageURL;
	
	public static final String SYSTEM_CONFIGS = "config.env.app";
	/**
	 * automatically generated serialVersionUID
	 */
	private static final long serialVersionUID = 4631744406950137811L;
	
	private CoreInitInfo() {
	}
	
	public static CoreInitInfo getInstance() {
		if (CI_INFO == null) {
			CI_INFO = new CoreInitInfo();
		} 
		return CI_INFO;
	}
	
	public Properties getSystemConfigs() {
		return this.systemConfigs;
	}

	public void setSystemConfigs(Properties systemConfigs) {
		this.systemConfigs = systemConfigs;
	}

	public String getSystemConfig(String key) {
		return systemConfigs.getProperty(key);
	}

	public String getMsgFileDirectory() {
		return msgFileDirectory;
	}

	public void setMsgFileDirectory(String msgFileDirectory) {
		this.msgFileDirectory = msgFileDirectory;
	}

	public String getDefaultErrorPageURL() {
		return defaultErrorPageURL;
	}

	public void setDefaultErrorPageURL(String defaultErrorPageURL) {
		this.defaultErrorPageURL = defaultErrorPageURL;
	}
	
	public boolean getBooleanProp(String key) {
		return Boolean.valueOf(getSystemConfig(key)).booleanValue();
	}
	

}
